# 文件读 / 写方法
# 打开/创建文件
with open(file="a.txt", mode="w", encoding="utf-8") as f:
    f.write("写入字符串test")

# 打开并读取文件内容
f = open("a.txt", "r+", encoding="utf-8")
s = f.read()
f.close()  # 关闭打开的文件
print(s)